 Imports MySql.Data.MySqlClient 
 Imports System.Data.OleDb
Imports System.Data.SqlClient
 Imports System .Data .SqlServerCe 
 Imports System.Data.OracleClient 
Imports System.Data
Imports DTO
Public Class PHONGDao
Inherits AbstractDao
 #Region "New" 
 Public Sub New(ByVal connection As KetNoiDto)
 MyBase.New(connection)
 End Sub
 Public Sub New( ByVal IDPHONG As System.Int32, ByVal connection As KetNoiDto)
 MyBase.New("PHONG", "select * from PHONG where IDPHONG=" & IDPHONG & "", connection)
 End Sub
 #End Region 
 Public Sub Them(ByVal Dto As PHONGDto)
 Dim strsql As String
 strsql = "Insert into PHONG(TENPHONG,SOBAN_GHE,NHANH,TRANGTHAI,GHICHU) values (?,?,?,?,?)
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 Dim cmd As New OleDbCommand(strsql, Ket_noi_access)
cmd.Parameters.Add("@TENPHONG", OleDbType.VarWChar)
cmd.Parameters.Add("@SOBAN_GHE", OleDbType.Integer)
cmd.Parameters.Add("@NHANH", OleDbType.Integer)
cmd.Parameters.Add("@TRANGTHAI", OleDbType.Integer)
cmd.Parameters.Add("@GHICHU", OleDbType.VarWChar)
cmd.Parameters("@TENPHONG").Value = Dto.TENPHONG
cmd.Parameters("@SOBAN_GHE").Value = Dto.SOBAN_GHE
cmd.Parameters("@NHANH").Value = Dto.NHANH
cmd.Parameters("@TRANGTHAI").Value = Dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = Dto.GHICHU
 cmd.ExecuteNonQuery()
 strsql = "Select @@IDENTITY"
 cmd = New OleDbCommand(strsql, Ket_noi_access)
 Dto.IDPHONG = cmd.ExecuteScalar()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress
 strsql = "Insert into PHONG(TENPHONG,SOBAN_GHE,NHANH,TRANGTHAI,GHICHU) values (@TENPHONG,@SOBAN_GHE,@NHANH,@TRANGTHAI,@GHICHU)
 Dim cmd As New sqlCommand(strsql, Ket_noi_sql)
cmd.Parameters.Add("@TENPHONG", SqlDbType.NVarChar)
cmd.Parameters.Add("@SOBAN_GHE", SqlDbType.Int)
cmd.Parameters.Add("@NHANH", SqlDbType.Int)
cmd.Parameters.Add("@TRANGTHAI", SqlDbType.Int)
cmd.Parameters.Add("@GHICHU", SqlDbType.NVarChar)
cmd.Parameters("@TENPHONG").Value = Dto.TENPHONG
cmd.Parameters("@SOBAN_GHE").Value = Dto.SOBAN_GHE
cmd.Parameters("@NHANH").Value = Dto.NHANH
cmd.Parameters("@TRANGTHAI").Value = Dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = Dto.GHICHU
 cmd.ExecuteNonQuery()
 strsql = "Select @@IDENTITY"
 cmd = New sqlCommand(strsql, Ket_noi_sql)
 Dto.IDPHONG = cmd.ExecuteScalar()
 Case Class_KieuDL.SqlCe
 strsql = "Insert into PHONG(TENPHONG,SOBAN_GHE,NHANH,TRANGTHAI,GHICHU) values (@TENPHONG,@SOBAN_GHE,@NHANH,@TRANGTHAI,@GHICHU)
 Dim cmd As New sqlceCommand(strsql, Ket_noi_SqlCe)
cmd.Parameters("@TENPHONG").Value = Dto.TENPHONG
cmd.Parameters("@SOBAN_GHE").Value = Dto.SOBAN_GHE
cmd.Parameters("@NHANH").Value = Dto.NHANH
cmd.Parameters("@TRANGTHAI").Value = Dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = Dto.GHICHU
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strsql = "Insert into PHONG(TENPHONG,SOBAN_GHE,NHANH,TRANGTHAI,GHICHU) values (@TENPHONG,@SOBAN_GHE,@NHANH,@TRANGTHAI,@GHICHU)
 Dim cmd As New OracleCommand(strsql, Ket_noi_Oracle)
cmd.Parameters("@TENPHONG").Value = Dto.TENPHONG
cmd.Parameters("@SOBAN_GHE").Value = Dto.SOBAN_GHE
cmd.Parameters("@NHANH").Value = Dto.NHANH
cmd.Parameters("@TRANGTHAI").Value = Dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = Dto.GHICHU
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Mysql
 strsql = "Insert into PHONG(TENPHONG,SOBAN_GHE,NHANH,TRANGTHAI,GHICHU) values (@TENPHONG,@SOBAN_GHE,@NHANH,@TRANGTHAI,@GHICHU)
 Dim cmd As New MySqlCommand(strsql, Ket_noi_MySql)
cmd.Parameters.Add("@TENPHONG", MySqlDbType.String)
cmd.Parameters.Add("@SOBAN_GHE", MySqlDbType.Int32)
cmd.Parameters.Add("@NHANH", MySqlDbType.Int32)
cmd.Parameters.Add("@TRANGTHAI", MySqlDbType.Int32)
cmd.Parameters.Add("@GHICHU", MySqlDbType.String)
cmd.Parameters("@TENPHONG").Value = Dto.TENPHONG
cmd.Parameters("@SOBAN_GHE").Value = Dto.SOBAN_GHE
cmd.Parameters("@NHANH").Value = Dto.NHANH
cmd.Parameters("@TRANGTHAI").Value = Dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = Dto.GHICHU
 cmd.ExecuteNonQuery()
 End Select
 Ngatketnoi()
 End Sub
 Public Sub Xoa( ByVal IDPHONG As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
strSQL = "Delete From PHONG Where IDPHONG= ? 
Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
cmd.Parameters.Add("@IDPHONG",OleDbType.Integer).Value = IDPHONG
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
strSQL = "Delete From PHONG Where IDPHONG= @IDPHONG
Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
cmd.Parameters.Add("@IDPHONG",SqlDbType.Int).value=IDPHONG
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
strSQL = "Delete From PHONG Where IDPHONG=" & IDPHONG & "
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
strSQL = "Delete From PHONG Where IDPHONG=" & IDPHONG & "
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
strSQL = "Delete From PHONG Where IDPHONG=" & IDPHONG & "
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select
 Ngatketnoi()
 End Sub
 Public Sub sua(ByVal dto As PHONGDto)
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update PHONG Set TENPHONG=? ,SOBAN_GHE=? ,NHANH=? ,TRANGTHAI=? ,GHICHU= ? where IDPHONG= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
cmd.Parameters.Add("@TENPHONG", OleDbType.VarWChar)
cmd.Parameters.Add("@SOBAN_GHE", OleDbType.Integer)
cmd.Parameters.Add("@NHANH", OleDbType.Integer)
cmd.Parameters.Add("@TRANGTHAI", OleDbType.Integer)
cmd.Parameters.Add("@GHICHU", OleDbType.VarWChar)
cmd.Parameters.Add("@IDPHONG", OleDbType.Integer)
cmd.Parameters("@TENPHONG").Value = dto.TENPHONG
cmd.Parameters("@SOBAN_GHE").Value = dto.SOBAN_GHE
cmd.Parameters("@NHANH").Value = dto.NHANH
cmd.Parameters("@TRANGTHAI").Value = dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = dto.GHICHU
cmd.Parameters("@IDPHONG").Value = dto.IDPHONG
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update PHONG Set TENPHONG= @TENPHONG , SOBAN_GHE= @SOBAN_GHE , NHANH= @NHANH , TRANGTHAI= @TRANGTHAI , GHICHU= @GHICHU where IDPHONG= @IDPHONG"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
cmd.Parameters.Add("@TENPHONG", SqlDbType.NVarChar)
cmd.Parameters.Add("@SOBAN_GHE", SqlDbType.Int)
cmd.Parameters.Add("@NHANH", SqlDbType.Int)
cmd.Parameters.Add("@TRANGTHAI", SqlDbType.Int)
cmd.Parameters.Add("@GHICHU", SqlDbType.NVarChar)
cmd.Parameters.Add("@IDPHONG", SqlDbType.Int)
cmd.Parameters("@TENPHONG").Value = dto.TENPHONG
cmd.Parameters("@SOBAN_GHE").Value = dto.SOBAN_GHE
cmd.Parameters("@NHANH").Value = dto.NHANH
cmd.Parameters("@TRANGTHAI").Value = dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = dto.GHICHU
cmd.Parameters("@IDPHONG").Value = dto.IDPHONG
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update PHONG Set TENPHONG= @TENPHONG , SOBAN_GHE= @SOBAN_GHE , NHANH= @NHANH , TRANGTHAI= @TRANGTHAI , GHICHU= @GHICHU where IDPHONG= @IDPHONG"
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
cmd.Parameters("@TENPHONG").Value = dto.TENPHONG
cmd.Parameters("@SOBAN_GHE").Value = dto.SOBAN_GHE
cmd.Parameters("@NHANH").Value = dto.NHANH
cmd.Parameters("@TRANGTHAI").Value = dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = dto.GHICHU
cmd.Parameters("@IDPHONG").Value = dto.IDPHONG
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update PHONG Set TENPHONG= @TENPHONG , SOBAN_GHE= @SOBAN_GHE , NHANH= @NHANH , TRANGTHAI= @TRANGTHAI , GHICHU= @GHICHU where IDPHONG= @IDPHONG"
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
cmd.Parameters("@TENPHONG").Value = dto.TENPHONG
cmd.Parameters("@SOBAN_GHE").Value = dto.SOBAN_GHE
cmd.Parameters("@NHANH").Value = dto.NHANH
cmd.Parameters("@TRANGTHAI").Value = dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = dto.GHICHU
cmd.Parameters("@IDPHONG").Value = dto.IDPHONG
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update PHONG Set TENPHONG= @TENPHONG , SOBAN_GHE= @SOBAN_GHE , NHANH= @NHANH , TRANGTHAI= @TRANGTHAI , GHICHU= @GHICHU where IDPHONG= @IDPHONG"
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
cmd.Parameters.Add("@TENPHONG", MySqlDbType.String)
cmd.Parameters.Add("@SOBAN_GHE", MySqlDbType.Int32)
cmd.Parameters.Add("@NHANH", MySqlDbType.Int32)
cmd.Parameters.Add("@TRANGTHAI", MySqlDbType.Int32)
cmd.Parameters.Add("@GHICHU", MySqlDbType.String)
cmd.Parameters.Add("@IDPHONG", MySqlDbType.Int32)
cmd.Parameters("@TENPHONG").Value = dto.TENPHONG
cmd.Parameters("@SOBAN_GHE").Value = dto.SOBAN_GHE
cmd.Parameters("@NHANH").Value = dto.NHANH
cmd.Parameters("@TRANGTHAI").Value = dto.TRANGTHAI
cmd.Parameters("@GHICHU").Value = dto.GHICHU
cmd.Parameters("@IDPHONG").Value = dto.IDPHONG
 cmd.ExecuteNonQuery()
 End Select
 Ngatketnoi()
 End Sub
 Public Sub SuaTENPHONG( ByVal TENPHONG as System.String, ByVal IDPHONG As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update PHONG Set TENPHONG = ?  where IDPHONG= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
 cmd.Parameters.Add("@TENPHONG", OleDbType.VarWChar)
 cmd.Parameters.Add("@IDPHONG", OleDbType.Integer)
 cmd.Parameters("@TENPHONG").Value =  TENPHONG
cmd.Parameters("@IDPHONG").Value =  IDPHONG
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update PHONG Set TENPHONG = @TENPHONG  where IDPHONG= @IDPHONG"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
 cmd.Parameters.Add("@TENPHONG", SqlDbType.NVarChar)
 cmd.Parameters.Add("@IDPHONG", SqlDbType.Int)
 cmd.Parameters("@TENPHONG").Value =  TENPHONG
cmd.Parameters("@IDPHONG").Value =  IDPHONG
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update PHONG Set TENPHONG =" & TENPHONG & "  where IDPHONG=" & IDPHONG & ""
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update PHONG Set TENPHONG =" & TENPHONG & "  where IDPHONG=" & IDPHONG & ""
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update PHONG Set TENPHONG =" & TENPHONG & "  where IDPHONG=" & IDPHONG & ""
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select 
 Ngatketnoi()
 End Sub
 Public Sub SuaSOBAN_GHE( ByVal SOBAN_GHE as System.Int32, ByVal IDPHONG As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update PHONG Set SOBAN_GHE = ?  where IDPHONG= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
 cmd.Parameters.Add("@SOBAN_GHE", OleDbType.Integer)
 cmd.Parameters.Add("@IDPHONG", OleDbType.Integer)
 cmd.Parameters("@SOBAN_GHE").Value =  SOBAN_GHE
cmd.Parameters("@IDPHONG").Value =  IDPHONG
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update PHONG Set SOBAN_GHE = @SOBAN_GHE  where IDPHONG= @IDPHONG"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
 cmd.Parameters.Add("@SOBAN_GHE", SqlDbType.Int)
 cmd.Parameters.Add("@IDPHONG", SqlDbType.Int)
 cmd.Parameters("@SOBAN_GHE").Value =  SOBAN_GHE
cmd.Parameters("@IDPHONG").Value =  IDPHONG
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update PHONG Set SOBAN_GHE =" & SOBAN_GHE & "  where IDPHONG=" & IDPHONG & ""
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update PHONG Set SOBAN_GHE =" & SOBAN_GHE & "  where IDPHONG=" & IDPHONG & ""
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update PHONG Set SOBAN_GHE =" & SOBAN_GHE & "  where IDPHONG=" & IDPHONG & ""
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select 
 Ngatketnoi()
 End Sub
 Public Sub SuaNHANH( ByVal NHANH as System.Int32, ByVal IDPHONG As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update PHONG Set NHANH = ?  where IDPHONG= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
 cmd.Parameters.Add("@NHANH", OleDbType.Integer)
 cmd.Parameters.Add("@IDPHONG", OleDbType.Integer)
 cmd.Parameters("@NHANH").Value =  NHANH
cmd.Parameters("@IDPHONG").Value =  IDPHONG
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update PHONG Set NHANH = @NHANH  where IDPHONG= @IDPHONG"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
 cmd.Parameters.Add("@NHANH", SqlDbType.Int)
 cmd.Parameters.Add("@IDPHONG", SqlDbType.Int)
 cmd.Parameters("@NHANH").Value =  NHANH
cmd.Parameters("@IDPHONG").Value =  IDPHONG
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update PHONG Set NHANH =" & NHANH & "  where IDPHONG=" & IDPHONG & ""
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update PHONG Set NHANH =" & NHANH & "  where IDPHONG=" & IDPHONG & ""
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update PHONG Set NHANH =" & NHANH & "  where IDPHONG=" & IDPHONG & ""
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select 
 Ngatketnoi()
 End Sub
 Public Sub SuaTRANGTHAI( ByVal TRANGTHAI as System.Int32, ByVal IDPHONG As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update PHONG Set TRANGTHAI = ?  where IDPHONG= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
 cmd.Parameters.Add("@TRANGTHAI", OleDbType.Integer)
 cmd.Parameters.Add("@IDPHONG", OleDbType.Integer)
 cmd.Parameters("@TRANGTHAI").Value =  TRANGTHAI
cmd.Parameters("@IDPHONG").Value =  IDPHONG
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update PHONG Set TRANGTHAI = @TRANGTHAI  where IDPHONG= @IDPHONG"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
 cmd.Parameters.Add("@TRANGTHAI", SqlDbType.Int)
 cmd.Parameters.Add("@IDPHONG", SqlDbType.Int)
 cmd.Parameters("@TRANGTHAI").Value =  TRANGTHAI
cmd.Parameters("@IDPHONG").Value =  IDPHONG
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update PHONG Set TRANGTHAI =" & TRANGTHAI & "  where IDPHONG=" & IDPHONG & ""
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update PHONG Set TRANGTHAI =" & TRANGTHAI & "  where IDPHONG=" & IDPHONG & ""
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update PHONG Set TRANGTHAI =" & TRANGTHAI & "  where IDPHONG=" & IDPHONG & ""
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select 
 Ngatketnoi()
 End Sub
 Public Sub SuaGHICHU( ByVal GHICHU as System.String, ByVal IDPHONG As System.Int32 )
 Dim strSQL As String
 Moketnoi()
 select case ketnoi.MSsql 
 Case Class_KieuDL.Access
 strSQL = "Update PHONG Set GHICHU = ?  where IDPHONG= ? "
 Dim cmd As New OleDbCommand(strSQL, Ket_noi_access)
 cmd.Parameters.Add("@GHICHU", OleDbType.VarWChar)
 cmd.Parameters.Add("@IDPHONG", OleDbType.Integer)
 cmd.Parameters("@GHICHU").Value =  GHICHU
cmd.Parameters("@IDPHONG").Value =  IDPHONG
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Sql,Class_KieuDL.sqlExpress 
 strSQL = "Update PHONG Set GHICHU = @GHICHU  where IDPHONG= @IDPHONG"
 Dim cmd As New sqlCommand(strSQL, Ket_noi_sql)
 cmd.Parameters.Add("@GHICHU", SqlDbType.NVarChar)
 cmd.Parameters.Add("@IDPHONG", SqlDbType.Int)
 cmd.Parameters("@GHICHU").Value =  GHICHU
cmd.Parameters("@IDPHONG").Value =  IDPHONG
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.SqlCe
 strSQL = "Update PHONG Set GHICHU =" & GHICHU & "  where IDPHONG=" & IDPHONG & ""
 Dim cmd As New SqlCeCommand(strSQL, Ket_noi_SqlCe)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.Oracle
 strSQL = "Update PHONG Set GHICHU =" & GHICHU & "  where IDPHONG=" & IDPHONG & ""
 Dim cmd As New OracleCommand(strSQL, Ket_noi_Oracle)
 cmd.ExecuteNonQuery()
 Case Class_KieuDL.MySql
 strSQL = "Update PHONG Set GHICHU =" & GHICHU & "  where IDPHONG=" & IDPHONG & ""
 Dim cmd As New MySqlCommand(strSQL, Ket_noi_MySql)
 cmd.ExecuteNonQuery()
 End Select 
 Ngatketnoi()
 End Sub
 Public Sub layBang()
 Chuoi_SQL = " Select * from PHONG
 Doc_bang()
 End Sub
 Public Sub layBangTheoIDPHONG(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "IDPHONG=" & ARRAY1.Item(i) & ""
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from PHONG" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoIDPHONG(ByVal IDPHONG As System.Int32 )
 Chuoi_SQL = " Select * from PHONG where  IDPHONG = " & IDPHONG & ""
 Doc_bang()
 End Sub
 Public Sub XOABangTheoIDPHONG(ByVal IDPHONG As System.Int32)
 Dim strsql As String
 strSQL = "Delete From PHONG Where IDPHONG=" & IDPHONG & ""
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangTheoTENPHONG(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "TENPHONG='" & ARRAY1.Item(i) & "'"
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from PHONG" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoTENPHONG_like (ByVal TENPHONG As System.String )
 Chuoi_SQL = " Select * from PHONG where  TENPHONG  like '%" & TENPHONG & "%'"
 Doc_bang()
 End Sub
 Public Sub layBangTheoTENPHONG(ByVal TENPHONG As System.String )
 Chuoi_SQL = " Select * from PHONG where  TENPHONG = '" & TENPHONG & "'"
 Doc_bang()
 End Sub
 Public Sub XOABangTheoTENPHONG(ByVal TENPHONG As System.String)
 Dim strsql As String
 strSQL = "Delete From PHONG Where TENPHONG='" & TENPHONG & "'"
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangTheoSOBAN_GHE(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "SOBAN_GHE=" & ARRAY1.Item(i) & ""
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from PHONG" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoSOBAN_GHE(ByVal SOBAN_GHE As System.Int32 )
 Chuoi_SQL = " Select * from PHONG where  SOBAN_GHE = " & SOBAN_GHE & ""
 Doc_bang()
 End Sub
 Public Sub XOABangTheoSOBAN_GHE(ByVal SOBAN_GHE As System.Int32)
 Dim strsql As String
 strSQL = "Delete From PHONG Where SOBAN_GHE=" & SOBAN_GHE & ""
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangTheoNHANH(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "NHANH=" & ARRAY1.Item(i) & ""
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from PHONG" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoNHANH(ByVal NHANH As System.Int32 )
 Chuoi_SQL = " Select * from PHONG where  NHANH = " & NHANH & ""
 Doc_bang()
 End Sub
 Public Sub XOABangTheoNHANH(ByVal NHANH As System.Int32)
 Dim strsql As String
 strSQL = "Delete From PHONG Where NHANH=" & NHANH & ""
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangTheoTRANGTHAI(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "TRANGTHAI=" & ARRAY1.Item(i) & ""
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from PHONG" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoTRANGTHAI(ByVal TRANGTHAI As System.Int32 )
 Chuoi_SQL = " Select * from PHONG where  TRANGTHAI = " & TRANGTHAI & ""
 Doc_bang()
 End Sub
 Public Sub XOABangTheoTRANGTHAI(ByVal TRANGTHAI As System.Int32)
 Dim strsql As String
 strSQL = "Delete From PHONG Where TRANGTHAI=" & TRANGTHAI & ""
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangTheoGHICHU(ByVal ARRAY1 As ArrayList)
 Dim DK As String = ""
 If ARRAY1.Count > 0 Then
 For I As Integer = 0 To ARRAY1.Count - 1
 DK = DK & IIf(DK <> "", " OR ", "") & "GHICHU='" & ARRAY1.Item(i) & "'"
 Next
 End If
 If DK <> "" Then DK = " WHERE " & DK 
 Chuoi_SQL = " Select * from PHONG" & DK
 Doc_bang()
 End Sub
 Public Sub layBangTheoGHICHU_like (ByVal GHICHU As System.String )
 Chuoi_SQL = " Select * from PHONG where  GHICHU  like '%" & GHICHU & "%'"
 Doc_bang()
 End Sub
 Public Sub layBangTheoGHICHU(ByVal GHICHU As System.String )
 Chuoi_SQL = " Select * from PHONG where  GHICHU = '" & GHICHU & "'"
 Doc_bang()
 End Sub
 Public Sub XOABangTheoGHICHU(ByVal GHICHU As System.String)
 Dim strsql As String
 strSQL = "Delete From PHONG Where GHICHU='" & GHICHU & "'"
 Thuc_hien_lenh(strsql)
 End Sub
 Public Sub layBangNhieuTable
 Chuoi_SQL = " Select IDPHONG ,TENPHONG ,SOBAN.GHE as SOBAN_GHE ,NHANH ,TRANGTHAI ,GHICHU  from PHONG"
 Doc_bang()
 End sub
Public Sub TaoTable()
Dim strsql As String
strsql = ""
Select Case ketnoi.MsSql
Case Class_KieuDL.Access 
Case Class_KieuDL.Sql, Class_KieuDL.sqlExpress
strsql = ""
Case Class_KieuDL.SqlCe
strsql = ""
Case Class_KieuDL.Oracle
strsql = ""
Case else 
strsql = ""
End Select
Thuc_hien_lenh(strsql)
End Sub
 End Class

